<!--  -->
<template>
  <div class="otc-main">
    <div class="asset-box">
      <div class="left">
        <span>USDT&nbsp;&nbsp;&nbsp;&nbsp;可用</span>
        <span>&nbsp;&nbsp;0.00000000</span>
        <span>&nbsp;&nbsp;/&nbsp;&nbsp;冻结&nbsp;&nbsp;&nbsp;&nbsp;0.0000000</span>
      </div>
      <div class="right">
        <router-link to>登录</router-link>
      </div>
    </div>
    <div class="entrust-box">
      <div class="tabs-container">
        <div class="left">
          <span>
            <router-link
              :to="`/otc/trade-markets-buy/${deal_coin}-${legal_tender}`"
              :class="deal_type=='buy'?'dp-green-text':''"
            >我要购买</router-link>
          </span>
          <el-divider direction="vertical"></el-divider>
          <span>
            <router-link
              :to="`/otc/trade-markets-sell/${deal_coin}-${legal_tender}`"
              :class="deal_type=='sell'?'dp-red-text':''"
            >我要出售</router-link>
          </span>
          <el-divider direction="vertical"></el-divider>
          <span>
            <router-link
              :to="`/otc/trade-markets-all/${deal_coin}-${legal_tender}`"
              :class="deal_type=='all'?'dp-blue-text':''"
            >盘口</router-link>
          </span>
        </div>
        <div class="right">发布委托</div>
      </div>
    </div>
    <div class="trade-box">
      <component :is="deal_type
    "></component>
    </div>
  </div>
</template>

<script>
import buy from "./buy";
import sell from "./sell";
import all from "./all";
export default {
  data() {
    return {
      legal_tender: "cny", //法币
      deal_coin: "usdt", //交易币
      deal_type: "buy" //交易类型
    };
  },
  components: {
    buy,
    sell,
    all
  },
  created() {
    this.getDealType();
  },
  mounted() {},
  methods: {
    getDealType() {
      let router = this.$route.params.type;
      this.deal_type = router.split("-")[2];
    }
  },
  watch: {
    $route: function() {
      this.getDealType();
    }
  }
};
</script>
<style scoped lang="less">
/* @import url(); 引入css类 */
.otc-main {
  color: rgba(0, 0, 0, 0.43);
  .asset-box {
    width: 100%;
    border-radius: 8px;
    background-color: #f8f8f8;
    height: 40px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 16px;
    .right {
      a {
        color: #3075ee;
      }
    }
  }
  .entrust-box {
    width: 100%;

    .tabs-container {
      margin: 32px 0 6px;
      display: flex;
      justify-content: space-between;
      padding-right: 16px;
    }
    .left {
      display: flex;
      align-items: center;
    }
    span {
      display: block;
      height: 28px;
      font-size: 20px;
      color: rgba(0, 0, 0, 0.65);
      cursor: pointer;
      font-weight: 500;
    }
    .el-divider {
      margin: 0 15px;
    }
    .right {
      color: #3075ee;
    }
  }
  //   组件属性穿透
  .trade-box /deep/ .trade {
    margin-bottom: 80px;
    .quick-trade {
      width: 100%;
      margin-top: 16px;
      padding: 23px 16px;
      background-image: url("../../../../public/img/otc_quick_trade.png");
      background-size: cover;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .left {
        .title {
          font-size: 20px;
          font-weight: 700;
          color: rgba(0, 0, 0, 0.85);
        }
        .desc {
          margin-top: 8px;
          font-size: 14px;
          color: #999;
        }
      }
      .right {
        display: flex;
        .select-box {
          .select {
            width: 120px;
          }
          margin-right: 12px;
          position: relative;
          .slot-end {
            position: absolute;
            right: 5px;
            top: 11px;
            color: rgba(0, 0, 0, 0.25);
          }
        }
        .input-with-select {
          width: 380px;
        }
      }
    }
    .trade-table {
      width: 100%;
      
      .trade {
        width: 240px;
      }
      .price {
        width: 125px;
      }
      .amount {
        width: 150px;
      }
      
      .limit {
        width: 165px;
      }
      .pay {
        width: 120px;
      }
      thead {
        color: rgba(0,0,0,.45);
        font-size: 14px;
        height: 46px;
        position: relative;

        th {
          font-weight: normal;
          text-align: right;
           border-bottom: 1px solid #e9e9e9;
          &:nth-of-type(1) {
            text-align: left;
            padding-left: 11px;
          }
          &:nth-last-of-type(1) {
            padding-right: 11px;
          }
        }
      }
      tbody {
        td {
          text-align: right;
          border-bottom: 1px solid #e9e9e9;
          &:nth-of-type(1) {
            text-align: left;
            padding-left: 11px;
          }
          &:nth-last-of-type(1) {
            padding-right: 11px;
          }
        }
        tr {
          height: 60px;
          background: transparent;
          border-bottom: 1px solid rgba(0, 0, 0, 0.05);
          transition: all 0.3s;
          color: rgba(0, 0, 0, 0.85);
          &:hover {
            box-shadow: 0 2px 2px rgba(0, 0, 0, 0.12),
              0 0 4px rgba(0, 0, 0, 0.04);
          }
        }
        .price {
          color: rgba(0, 0, 0, 0.75);
          font-weight: 700;
        }
        .iconfont {
          color: #98abcc;
        }
      }
    }
  }
}
</style>